package com.wizinno.android.urineflow.mqtt;

import com.alibaba.fastjson.JSON;
import com.wizinno.android.urineflow.mqtt.vo.PowerOnVO;
import com.wizinno.android.urineflow.service.MQTTService;
import com.wizinno.android.urineflow.util.CommonUtil;

/**
 * @author LiuMei
 * @date
 */
public class MqttUtil {

    //发布开机主题
    public static void pubPowerOn() {
        PowerOnVO powerOnVO = new PowerOnVO();
        powerOnVO.setIp(CommonUtil.getHostIP());
        powerOnVO.setVersion("v1.0");
        powerOnVO.setNetworking(MQTTService.networkType);
        MQTTService.publish(MqttPubTopic.EVENT_POWERON, JSON.toJSONString(powerOnVO));
    }

    //发布关机主题
    public static void pubPowerOff() {
        MQTTService.publish(MqttPubTopic.EVENT_POWEROFF,"程序关闭");
    }
}
